package com.yztstudy.controller;


import com.yztstudy.dto.Result;
import com.yztstudy.service.IFollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * follow的表示层
 */
@RestController
@RequestMapping("/follow")
public class FollowController {


    @Resource
    private IFollowService followService;

    /**
     * TODO 关注或者取关用户
     * @param follow_id 被关注的人的ID
     * @param isFollow 是否关注
     * @return
     */
    @PutMapping("/{follow_id}/{isFollow}")
    public Result follow(@PathVariable("follow_id") Long follow_id, @PathVariable("isFollow") Boolean isFollow)
    {
        return followService.follow(follow_id, isFollow);
    }


    /**
     * TODO 关注与否
     * @param follow_id 被关注的人的ID
     * @return
     */
    @GetMapping("/or/not/{follow_id}")
    public Result followOrNot(@PathVariable("follow_id") Long follow_id)
    {
        return followService.followOrNot(follow_id);
    }


    /**
     * TODO 查询共同关注的人
     * @param follow_id
     * @return
     */
    @GetMapping("/common/{id}")
    public Result commonFollow(@PathVariable("id") Long follow_id)
    {
        return followService.commonFollow(follow_id);
    }

}
